#ifndef IMAGESTRATEGY_H
#define IMAGESTRATEGY_H

#pragma once

#include "../../ToolkitLayer.h"
#include <LDF/VisComponentStrategy.h>

/**
 * This strategy loads an image file and displays it in a quad.
 *
 * @author Fabricio Anastacio - fabriciocfa@yahoo.com
 * @since August 3, 2007
 */
class TOOLKITLAYER_API ImageStrategy : public VisComponentStrategy
{
	// Attributes
protected:
	/** The name of the texture used by this strategy. */
	unsigned int textureName;
	/** The display list identifier. */
	unsigned int dlImage;
	/** The picking display list identifier. */
	unsigned int dlImagePicking;
	/** The width value currently used by the display list. */
	unsigned int dlWidth;
	/** The height value currently used by the display list. */
	unsigned int dlHeight;


	// Methods
public:
	/**
	 * Constructs an image strategy with texture given by the specified texture
	 * name.
	 *
	 * @param texName the OpenGL texture name to be used when drawing.
	 */
	ImageStrategy(unsigned int texName);
	/**
	 * Destroys this image strategy.
	 */
	~ImageStrategy(void);

	/** Returns the texture name identifier for this ImageStrategy. */
	inline unsigned int getTextureName() { return textureName; };


protected:
	/**
	 * Creates the display list to draw this image as a texture in a quad.
	 */
	void createDisplayList();

	/**
	 * Defines the drawing strategy for the associated component.
	 *
	 * @param enablePicking if true, draw for selection mode (adding the
	 * component id).
	 */
	void draw(const std::vector<unsigned long>& selectedIds);
	/**
	 * Defines the drawing strategy for the associated component that should be
	 * used for picking.
	 */
	void drawForPicking();
	
};

#endif // IMAGESTRATEGY_H
